I can't wait for the hyper operators to be implemented in pugs. Take the following example:
my $count; my @apples = (32, 38, 37, 29, 41); # apples in each bushel $count += $_ for @apples; # total number of apples $count.say;I'd like to do it like this (if it's valid to declare $count in this way):
my @apples = (32, 38, 37, 29, 41); # apples in each bushel my $count +=<<@apples; # total number of apples $count.say;
my @credits = (5, 20, 125.50, 37.25); my @debits = (3.66, 11.77, 23.99, 40.12, 9.95); my @balances = @credits; @balances[$_] -= @debits[$_] for (0 .. @debits.elems - 1); my $total; $total += $_ for @balances; $total.say;Could be written as:
my @credits = (5, 20, 125.50, 37.25); my @debits = (3.66, 11.77, 23.99, 40.12, 9.95); my @balances = @credits >>-<< @debits; my $total +=<<@balances; $total.say;
my $count +=<<@apples; # total number of apples
my $count = sum @apples;
my $count = @apples.sum;
Re:sum?
Mr. Muskrat on 2005-04-16T00:38:40
Oooo! I didn't know about.sum! Thank you.